#!/bin/bash

echo "╔════════════════════════════════════════════════════════════════════════════╗"
echo "║              🚀 启动开发环境（MySQL + Redis）                                 ║"
echo "╚════════════════════════════════════════════════════════════════════════════╝"
echo ""

SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd)
COMPOSE_DEV="$SCRIPT_DIR/docker-compose.dev.yml"
export COMPOSE_FILE="$COMPOSE_DEV"

# 步骤1: 启动MySQL和Redis
echo "📦 步骤1: 启动MySQL和Redis容器..."
docker-compose up -d

# 等待服务就绪
echo "⏳ 等待MySQL和Redis就绪..."
sleep 10

# 检查服务状态
echo ""
echo "📊 服务状态:"
docker-compose ps

echo ""
echo "✅ MySQL和Redis已启动！"
echo ""
echo "🔗 连接信息:"
echo "   MySQL: localhost:3306"
echo "   Redis: localhost:6379"
echo ""
echo "📋 下一步:"
echo "   1. 启动NestJS: cd $SCRIPT_DIR/.. && npm run start:dev"
echo "   2. 启动Admin:  cd $SCRIPT_DIR/../admin && npm run dev"
echo ""
